<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 200px;
            background-color: red;
            transition: background-color 1s;
            border: 10px  yellow;
        }
    </style>
</head>
<body>
    <div class="text"></div>
    <div class="box"></div>

    

    <script>
        const box = document.querySelector('.box');
        
        box.addEventListener('mouseover', function() {
            box.style.width = 200 + 'px';
            console.log(box.offsetWidth );
            box.style.width = 300 + 'px';
            console.log(box.offsetWidth );
            box.style.width = 400 + 'px';
            console.log(box.offsetWidth );
            box.style.width = 50 + 'px';
            console.log(box.offsetWidth );
        });
    </script>
</body>
</html>